package com.artpri.dao.impl;

import java.util.List;

import com.artpri.dao.DeliverAddDao;
import com.artpri.model.DeliverAdd;

/**
 * 
 * @author ZhangSi
 *
 */
public class DeliverAddDaoImpl extends HibernateDaoImpl<DeliverAdd> implements DeliverAddDao{

	@Override
	public List<DeliverAdd> getDeliverAddByUser(Integer userNum) {
		return find("from DeliverAdd d where d.userNum=?0", userNum);
	}

	@Override
	public DeliverAdd getDefaultAdd(Integer userNum) {
		return (DeliverAdd) getQuery("from DeliverAdd d where d.userNum=?0 and d.ifdefault=1", userNum).uniqueResult();
	}

	@Override
	public int getAddressCount(Integer userNum) {
		return findCount("select count(*) from DeliverAdd d where d.userNum=?0", userNum);
	}

	
}
